import {
  DIC
} from '@/const/dic'
export const option = {
  index:true,
  indexLabel:'序号',
  border: true,
  selection: false,
  menuBtn: true,
  addBtn: false,
  cellBtn: false,
  editBtn: false,
  size:'mini',
  delBtn: false,
  columnBtn: false,
  refreshBtn: false,
  // dicData: DIC,
  align: "center",
  menuWidth: 110,
  menuAlign: "center",
  column: [{
    label: "审批单号",
    prop: "approvalNumber",
  },{
    label: "设备类别",
    prop: "equipmentTypeName",
    slot: true,
  },{
    label: "设备编码",
    prop: "coded",
    slot: true,
  },{
    label: "设备名称",
    prop: "equipmentName",
    slot: true,
  },{
    label: "型号",
    prop: "marking",
    slot: true,
  },{
    label: "品牌",
    prop: "brand",
    slot: true,
  },{
    label: "实验室",
    prop: "laboratory",
    slot: true
  },{
    label: "预约部门/人",
    prop: "ant",
    slot: true,
  },{
    label: "预约时间",
    prop: "startTime",
      width:150,
    slot: true,
  }]
};
export function jsonToArray(nodes) {
  var r=[];
  if (Array.isArray(nodes)) {
    for (var i=0, l=nodes.length; i<l; i++) {
      r.push(nodes[i]); // 取每项数据放入一个新数组
      if (Array.isArray(nodes[i]["children"])&&nodes[i]["children"].length>0)
       // 若存在children则递归调用，把数据拼接到新数组中，并且删除该children
        r = r.concat(jsonToArray(nodes[i]["children"]));
          delete nodes[i]["children"]
    }
  } 
  return r;
}
